﻿using KinectWindows.Windows;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KinectWindowLib;

namespace KinectWindowLib
{
    /// <summary>
    ///  The Application class that all the Nui Applications are drived from
    /// </summary>
    public class NuiApplication
    {
        public static bool IsRunning { get; set; }
        private static NuiWindow RootWindow { set; get; }


        /// <summary>
        /// Start Running Thw window Application
        /// </summary>
        /// <param name="rootWindow"></param>
        public void Run(NuiWindow rootWindow)
        {
            NuiApplication.RootWindow = rootWindow;
            (new System.Threading.Thread(new System.Threading.ThreadStart(Start))).Start();
        }
        // Called by the window manager to process App Specific Messages
        public void Start()
        {
            NuiApplication.IsRunning = true;
            while (NuiApplication.IsRunning)
            {
                NuiEvent nevent = NuiEventManager.GetEvent();
                if (nevent != null)
                {

                    InterpreteMessage(nevent);
                   
                }

            }

            
            
          
        }

        public virtual void InterpreteMessage(NuiEvent nevent)
        {
           
        }



        

        public int OSThreadId { get; set; }
    }
}
